﻿@model MMITWeb.Models.RegisterViewModel

@{
    ViewBag.Title = "User Account: Register";
}
<script type="text/javascript">

    $(document).ready(function () {
        $("#CountryId").bind('valueChange', function (e) {
            var countryId = $("#CountryId").val();
            if (countryId == '0' || countryId == "") {
                alert('[Error: Select a Country] Please select a Country');
            }
            else {
                $.ajax({
                    contentType: 'application/html; charset=utf-8',
                    type: 'GET',
                    dataType: 'html',
                    url: 'GetCountryCode/',
                    dataType: 'html',
                    data: {
                        CountryId: countryId
                    }
                }).success(function (result) {
                    // Display the section contents.
                    result = eval("(" + result + ")");
                    $('#CountryCode').val('\+'+result.code);
                    //alert(result.code);
                });

            }
        });

    });
</script>

<div id="page" class="container">

<h2>Register</h2>
<div class="post" style="margin-left: 20px; font-size: smaller; text-align: justify">
            To register, please fill the form below: 
         <br />
           Required fields are marked with (*) 

</div>
@using(Html.BeginForm())
{
    @Html.ValidationSummary(false)   
    
    <fieldset><legend>Login Details</legend>
        <br />@Html.LabelFor(p => p.UserName)
        <br />@Html.TextBoxFor(p => p.UserName)*
        <br />@Html.LabelFor(p => p.Password)
        <br />@Html.PasswordFor(p => p.Password)*
        <br />@Html.LabelFor(p => p.ConfirmPassword)
        <br />@Html.PasswordFor(p => p.ConfirmPassword)*    
    </fieldset>
    <fieldset><legend>Profile Data</legend>
        <br />@Html.LabelFor(p => p.Firstname)
        <br />@Html.TextBoxFor(p => p.Firstname)*
        <br />@Html.LabelFor(p => p.Middlename)
        <br />@Html.TextBoxFor(p => p.Middlename)*
        <br />@Html.LabelFor(p => p.Lastname)
        <br />@Html.TextBoxFor(p => p.Lastname)*
        <br />@Html.LabelFor(p => p.Sex)
        <br />@(Html.Telerik().DropDownListFor(p => p.Sex).HtmlAttributes(new { style = "width: 150px" })
                                        .Name("Sex")
                                        .Items(item =>
                                                {
                                                    item.Add().Text("-- Select Gender--").Value("0");
                                                    item.Add().Text("Male").Value("M");
                                                    item.Add().Text("Female").Value("F");
                                                }
                                          )
                                        )*
        <br />@Html.LabelFor(p => p.Email)
        <br />@Html.TextBoxFor(p => p.Email)*
        <br />@Html.Label("Select Country")
    <br />@(Html.Telerik().DropDownList().HtmlAttributes(new { style = "width: 250px" })
                                        .Name("CountryId")
                                        .BindTo(Model.Countries)
                                        .Placeholder("--- Select a Country ---")
                                        )*
        <br />@Html.LabelFor(p => p.Mobile)
        <br />@Html.TextBoxFor(p => p.CountryCode, new { style = "width: 40px" })&nbsp @Html.TextBoxFor(p => p.Mobile)*
    <br />@Html.Label("Select Identification Type")

    <br />@(Html.Telerik().DropDownList().HtmlAttributes(new { style = "width: 250px" })
                                        .Name("IdentificationTypeId")
                                        .BindTo(Model.IdentificationTypes)
                                        .Placeholder("--- Select an Identification Type ---")
                                        )*
        <br />@Html.LabelFor(p => p.IdentificationNumber)
        <br />@Html.TextBoxFor(p => p.IdentificationNumber)*
        
   
    </fieldset>
    <p><input type="submit" value="Register" class="t-button t-button-icontext" 
            style="border: none; height: 32px; cursor: pointer; margin-top: 20px; margin-left: 20px""/>
            <input type="reset" value="Cancel" class="t-button t-button-icontext" 
            style="border: none; height: 32px; cursor: pointer; margin-top: 20px; margin-left: 5px""/>
    </p>   
}
</div>